|
1
|
|
|
var assert = require('chai').assert, |
|
2
|
|
|
GedcomX = require('../../'); |
|
3
|
|
|
|
|
4
|
|
|
describe('PlaceDisplayProperties', function(){ |
|
5
|
|
|
|
|
6
|
|
|
var json = { |
|
7
|
|
|
name: 'place name', |
|
8
|
|
|
fullName: 'place name, in a place', |
|
9
|
|
|
type: 'place type' |
|
10
|
|
|
}; |
|
11
|
|
|
|
|
12
|
|
|
it('Create plain', function(){ |
|
13
|
|
|
assert.instanceOf(new GedcomX.PlaceDisplayProperties(), GedcomX.PlaceDisplayProperties, 'An instance of PlaceDisplayProperties is not returned when calling the constructor with new.'); |
|
14
|
|
|
assert.instanceOf(GedcomX.PlaceDisplayProperties(), GedcomX.PlaceDisplayProperties, 'An instance of PlaceDisplayProperties is not returned when calling the constructor without new.'); |
|
15
|
|
|
}); |
|
16
|
|
|
|
|
17
|
|
|
it('Create with JSON', function(){ |
|
18
|
|
|
test(GedcomX.PlaceDisplayProperties(json)); |
|
19
|
|
|
}); |
|
20
|
|
|
|
|
21
|
|
|
it('Build', function(){ |
|
22
|
|
|
test(GedcomX.PlaceDisplayProperties() |
|
23
|
|
|
.setName(json.name) |
|
24
|
|
|
.setFullName(json.fullName) |
|
25
|
|
|
.setType(json.type)); |
|
26
|
|
|
}); |
|
27
|
|
|
|
|
28
|
|
|
it('toJSON', function(){ |
|
29
|
|
|
assert.deepEqual(GedcomX.PlaceDisplayProperties(json).toJSON(), json); |
|
30
|
|
|
}); |
|
31
|
|
|
|
|
32
|
|
|
it('constructor does not copy instances', function(){ |
|
33
|
|
|
var obj1 = GedcomX.PlaceDisplayProperties(); |
|
34
|
|
|
var obj2 = GedcomX.PlaceDisplayProperties(obj1); |
|
35
|
|
|
assert.strictEqual(obj1, obj2); |
|
36
|
|
|
}); |
|
37
|
|
|
|
|
38
|
|
|
}); |
|
39
|
|
|
|
|
40
|
|
|
function test(display){ |
|
41
|
|
|
assert.equal(display.getName(), 'place name'); |
|
42
|
|
|
assert.equal(display.getFullName(), 'place name, in a place'); |
|
43
|
|
|
assert.equal(display.getType(), 'place type'); |
|
44
|
|
|
} |